package com.zhiyou100.service;

import com.zhiyou100.mapper.UserMapper;
import com.zhiyou100.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserService {
    @Autowired
    UserMapper userMapper;
    public List<User> listUser(Map map) {
        List<User> Users =  userMapper.listUser(map);
        return Users;

    }

    public int addUser(User User) {
       int  i  =  userMapper.addUser(User);
       return i;
    }

    public int updateUser(User User) {
        int  i  =  userMapper.updateUser(User);
        return i;
    }

    public User lookUser(int id) {
        User User =  userMapper.lookUser(id);
        return User;
    }

    public int deleteAll(List<Integer> UserIds) {
      int i =   userMapper.deleteAll(UserIds);
      return i;
    }

    public int delete(int id) {
       int i =  userMapper.delete(id);
       return  i;
    }

    public String findPasswordByTel(String phoneNum) {
       String pwd =  userMapper.findPasswordByTel(phoneNum);
       return  pwd;
    }

    public int updatePasswordByTel(String newPassword, String phoneNum) {
        int i =  userMapper.updatePasswordByTel(newPassword,phoneNum);
        return  i;
    }
}
